Telegram Group & Telegram Channel
143. Program to allocate memory using malloc() and free memory using free().

#include<stdio.h>
#include<stdlib.h>

int main() {

int n, i, *ptr, sum = 0;
printf("Enter total number of elements : ");
scanf("%d", &n);

ptr = (int *) malloc(n * sizeof(int));

if (ptr == NULL) {
printf("Error! Memory not allocated.");
return 0;
}

printf("Enter elements of array : \n");
for (i = 0; i < n; ++i) {
scanf("%d", ptr + i);
sum += *(ptr + i);
}

printf("Elements are :\n");
for (i = 0; i < n; i++) {
printf("%d\n", ptr[i]);
}

free(ptr);
return 0;
}
@C_Codings



tg-me.com/C_Codings/205
Create:
Last Update:

143. Program to allocate memory using malloc() and free memory using free().

#include<stdio.h>
#include<stdlib.h>

int main() {

int n, i, *ptr, sum = 0;
printf("Enter total number of elements : ");
scanf("%d", &n);

ptr = (int *) malloc(n * sizeof(int));

if (ptr == NULL) {
printf("Error! Memory not allocated.");
return 0;
}

printf("Enter elements of array : \n");
for (i = 0; i < n; ++i) {
scanf("%d", ptr + i);
sum += *(ptr + i);
}

printf("Elements are :\n");
for (i = 0; i < n; i++) {
printf("%d\n", ptr[i]);
}

free(ptr);
return 0;
}
@C_Codings

BY C Language πŸ‘¨β€πŸ’»


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/C_Codings/205

View MORE
Open in Telegram


C Language ‍ Telegram | DID YOU KNOW?

Date: |

Telegram Be The Next Best SPAC

I have no inside knowledge of a potential stock listing of the popular anti-Whatsapp messaging app, Telegram. But I know this much, judging by most people I talk to, especially crypto investors, if Telegram ever went public, people would gobble it up. I know I would. I’m waiting for it. So is Sergei Sergienko, who claims he owns $800,000 of Telegram’s pre-initial coin offering (ICO) tokens. β€œIf Telegram does a SPAC IPO, there would be demand for this issue. It would probably outstrip the interest we saw during the ICO. Why? Because as of right now Telegram looks like a liberal application that can accept anyone - right after WhatsApp and others have turn on the censorship,” he says.

Telegram Auto-Delete Messages in Any Chat

Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.

C Language ‍ from ye


Telegram C Language πŸ‘¨β€πŸ’»
FROM USA